namespace Pumpkin.FrameBase
{
    public static class BaseCrossType
    {
        public const string UIController = "KBE_HotFix.UI.UIController";
        public const string SceneManager = "KBE_HotFix.Scene.SceneManager";
        public const string Event = "KBE_HotFix.Event";
        public const string Messages = "KBE_HotFix.Messages";
        public const string KBEngineApp = "KBE_HotFix.KBEngineApp";
        public const string HotFixGameMain = "KBE_HotFix.Game.GameMain";
        public const string ConfigLoader = "KBE_HotFix.Config.ConfigLoadHelper";
        public const string HotFixUIHandler = "KBE_HotFix.UI.UIHandler";
        public const string HotFixUIObject = "KBE_HotFix.UI.UIObject";

        public static void Init()
        {
            //uicontroller
            RegistMethod(UIController, "DoGetHotFixCls", 1);

            //scenemanager
            RegistMethod(SceneManager, "OnSceneLoaded", 1);
            RegistMethod(SceneManager, "OnUIRootLoaded", 1);
            RegistMethod(SceneManager, "SetInstance", 1);

            //event
            RegistMethod(Event, "registerOut", 3);
            RegistMethod(Event, "deregisterOut", 3);
            RegistMethod(Event, "registerIn", 3);
            RegistMethod(Event, "deregisterIn", 3);
            RegistMethod(Event, "fireOut", 2);
            RegistMethod(Event, "fireIn", 2);
            RegistMethod(Event, "fireAll", 2);
            RegistMethod(Event, "deregisterAllIn", 1);
            RegistMethod(Event, "clear", 0);

            //Messages
            RegistMethod(Messages, "getClientMessage", 1);
            RegistMethod(Messages, "getClientMessageCls", 1);

            //KBEngineApp
            RegistMethod(KBEngineApp, "getClientType", 0);
            RegistMethod(KBEngineApp, "getNetEncryptType", 0);
            RegistMethod(KBEngineApp, "getServerVersion", 0);
            RegistMethod(KBEngineApp, "updatePlayerToServer", 0);
            RegistMethod(KBEngineApp, "InitializeApp", 1);
            RegistMethod(KBEngineApp, "destroy", 1);

            //HotFixGameMain
            RegistMethod(HotFixGameMain, "Main", 0);

            //ConfigLoadHelper
            RegistMethod(ConfigLoader, "Load", 3);

            //UIHandler
            RegistMethod(HotFixUIHandler, "DoGetHotFixCls", 1);

            //UIObject
            RegistMethod(HotFixUIObject, "SetRoot", 1);
        }

        public static void RegistMethod(string name, string method, int paramCount)
        {
            CrossMethods.Instance.Add(name, method, paramCount);
        }

        public static bool IsClassRegisted(string name)
        {
            return CrossMethods.Instance.IsClassRegisted(name);
        }
    }
}
